#include<stdio.h>
#include<stdlib.h>
#include<dirent.h>
#include<sys/types.h>
#include<fcntl.h>

int main()
{
	DIR *dir = opendir(".");
	if(!dir){	
		perror("opendir");
		return -1;
	}

	printf("opendir success!\n");
	
	printf("DT_REG = %d,DT_DIR = %d\n",DT_REG,DT_DIR);

	struct dirent * dp = readdir(dir);
	if(dp){
		printf("type = %d,name = %s\n",dp->d_type,dp->d_name);
	}

	dp = readdir(dir);
	if(dp){
		printf("type = %d,name = %s\n",dp->d_type,dp->d_name);
	}

	dp = readdir(dir);
	if(dp){
		printf("type = %d,name = %s\n",dp->d_type,dp->d_name);
	}


	closedir(dir);
	
	return 0;


}
